package tst

class B2 {
	static Closure rule= {
		println "B， this:${this.toString()}, delegate:${delegate.toString()},superclass:${delegate.getClass().superclass.name}"
		delegate.with(C2.rule)
	}
}

class C2 {
	static Closure rule= {
		println "C，this:${this.toString()}, delegate:${delegate.toString()},superclass:${delegate.getClass().superclass.name}"
		delegate.with(D2.rule)
	}
}

class D2 {
	static Closure rule= {
		println "D， this:${this.toString()}, delegate:${delegate.toString()},superclass:${delegate.getClass().superclass.name}"
		println "variables:${var}"
		ret = 'success'
	}
}

var = 'helloworld'

//Closure c = {}
//println c.toString()
//
with(B2.rule);
println ret;
println this.binding.variables;


